/**
 * Authors - Oren Bracha, Rony Lahav & Yehuda Eterman
 * This class represents the DeleteDB command. It gets the parameter of the command
 * and performs the command when needed (by deleting the DB if needed and shutting down)
 */
public class CmdDeleteDB implements ICmd{

	private String toDelete;	//0=don't delete, 1=delete
	private String command;		//for printing
	
	//CTOR
	CmdDeleteDB(String toDelete, String command){
		this.toDelete=toDelete;
		this.command=command;
	}

	//if toDelete equals 1 we delete the database content and exit with SHUTDOWN
	//if 0 we don't delete and exit with SHUTDOWN, if anything else we don't do anything
	public void executeCmd(){
		Logger.getInstance().printCommandDetails("deletedb", command);
		if (Integer.parseInt(toDelete) == 1){
			DataBase.getInstance().cleanDB();
			proj350.shutDown = true;
		}
		else if (Integer.parseInt(toDelete) == 0){
			proj350.shutDown = true;
		}
	}
}
